package 异常;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Exception2 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);

        try {
            System.out.println("请输入数字啊");
            int a=scanner.nextInt();
            System.out.println("请输入数字B");
            int b=scanner.nextInt();
            if(a%b==0){
                System.out.printf("%d / %d=%d%n",a,b,a/b);
            }else {
                System.out.printf("%d / %d=%d...%d%n",a,b,a/b,a%b);
            }

        }catch (InputMismatchException e){
            System.out.println("输入整数");
        }catch (ArithmeticException e){
            System.out.println("不能输入0");
        }catch (Exception e){
            System.out.println("未知错误");
        }
    }
}
